# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription do
  @moduledoc """
  Provides detailed information for a particular field that is part of a PolicySchema.

  ## Attributes

  *   `defaultValue` (*type:* `any()`, *default:* `nil`) - Output only. Client default if the policy is unset.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Deprecated. Use name and field_description instead. The description for the field.
  *   `field` (*type:* `String.t`, *default:* `nil`) - Output only. The name of the field for associated with this description.
  *   `fieldConstraints` (*type:* `GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1FieldConstraints.t`, *default:* `nil`) - Output only. Information on any input constraints associated on the values for the field.
  *   `fieldDependencies` (*type:* `list(GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDependencies.t)`, *default:* `nil`) - Output only. Provides a list of fields and values. At least one of the fields must have the corresponding value in order for this field to be allowed to be set.
  *   `fieldDescription` (*type:* `String.t`, *default:* `nil`) - Output only. The description of the field.
  *   `inputConstraint` (*type:* `String.t`, *default:* `nil`) - Output only. Any input constraints associated on the values for the field.
  *   `knownValueDescriptions` (*type:* `list(GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldKnownValueDescription.t)`, *default:* `nil`) - Output only. If the field has a set of known values, this field will provide a description for these values.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The name of the field.
  *   `nestedFieldDescriptions` (*type:* `list(GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription.t)`, *default:* `nil`) - Output only. Provides the description of the fields nested in this field, if the field is a message type that defines multiple fields. Fields are suggested to be displayed by the ordering in this list, not by field number.
  *   `requiredItems` (*type:* `list(GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaRequiredItems.t)`, *default:* `nil`) - Output only. Provides a list of fields that are required to be set if this field has a certain value.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :defaultValue => any() | nil,
          :description => String.t() | nil,
          :field => String.t() | nil,
          :fieldConstraints =>
            GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1FieldConstraints.t() | nil,
          :fieldDependencies =>
            list(
              GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDependencies.t()
            )
            | nil,
          :fieldDescription => String.t() | nil,
          :inputConstraint => String.t() | nil,
          :knownValueDescriptions =>
            list(
              GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldKnownValueDescription.t()
            )
            | nil,
          :name => String.t() | nil,
          :nestedFieldDescriptions =>
            list(
              GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription.t()
            )
            | nil,
          :requiredItems =>
            list(
              GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaRequiredItems.t()
            )
            | nil
        }

  field(:defaultValue)
  field(:description)
  field(:field)

  field(:fieldConstraints,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1FieldConstraints
  )

  field(:fieldDependencies,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDependencies,
    type: :list
  )

  field(:fieldDescription)
  field(:inputConstraint)

  field(:knownValueDescriptions,
    as:
      GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldKnownValueDescription,
    type: :list
  )

  field(:name)

  field(:nestedFieldDescriptions,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription,
    type: :list
  )

  field(:requiredItems,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaRequiredItems,
    type: :list
  )
end

defimpl Poison.Decoder,
  for: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription do
  def decode(value, options) do
    GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
